package service;

import java.sql.SQLException;
import java.util.List;

import dao.UserDao;
import model.UserCommentInfo;
import model.UserInfo;

public class UserService {
	public boolean checkLogin(String userName,String passWord) throws SQLException {
		UserDao userDao = new UserDao();
		boolean result = userDao.checkLogin(userName, passWord);
		return result;
	}
	public boolean checkManagerLogin(String managerName,String passWord) throws SQLException{
		UserDao userDao = new UserDao();
		return userDao.checkManagerLogin(managerName, passWord);
	}
	public boolean checkRegister(String userName,String passWord) throws SQLException {
		UserDao userDao = new UserDao();
		boolean result = userDao.checkRegister(userName, passWord);
		return result;
	}
	public boolean addUserComment(String userName, String comment,String phoneName) throws SQLException{
		UserDao userDao = new UserDao();
		return userDao.addUserComment(userName, comment, phoneName);
	}
	public List<UserCommentInfo> getUserCommentList(String phoneName) throws SQLException{
		UserDao userDao = new UserDao();
		List<UserCommentInfo> commentList = userDao.getUserCommentList(phoneName);
		return commentList;
	}
	public boolean updateUserJoinActivity(String userName,String activityName) throws SQLException {
		UserDao userDao = new UserDao();
		return userDao.updateUserJoinActivity(userName, activityName);
	}
	public int checkUserReputation(String userName) throws SQLException {
		UserDao userDao = new UserDao();
		return userDao.checkUserReputation(userName);
	}
	public List<UserInfo> checkJoinActivityUsers() throws SQLException {
		UserDao userDao = new UserDao();
		return userDao.checkJoinActivityUsers();
	}
	
	/*
	 * 以下皆为后台管理代码
	 */
	public List<UserCommentInfo> getCommentInfosList() throws SQLException{
		UserDao userDao = new UserDao();
		List<UserCommentInfo> commentInfosList = userDao.getCommentInfosList();
		return commentInfosList;
	}
	public boolean deleteComment(int userId) throws SQLException {
		UserDao userDao = new UserDao();
		boolean result = userDao.deleteComment(userId);
		return result;
	}
	public boolean updateUserReputation(String userName) throws SQLException {
		UserDao userDao = new UserDao();
		boolean result= userDao.updateUserReputation(userName);
		return result;
	}
}
